{extend name="public/base" /}
{block name="style"}<link href="__LIB__/fileinput/css/fileinput.min.css" rel="stylesheet" /> {/block}
 {block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li>
			<a href="{:url('index',['type'=>$type])}">
				{if $type=='discount'}
				优惠购商品
				{elseif $type=='score'}
				赚积分商品
				{else}
				疯狂抢商品
				{/if}
			</a>
		</li>
		<li><strong>查看商品</strong></li>
	</ol>
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<div class="ibox-content">
				<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('edit')}">
				<input type="hidden" name="id" value="{$ad.id}" />
				<!--商品基本信息-->
				<div class="panel panel-default">
				<div class="panel-heading"> 基本信息</div>
					<div class="panel-body">
					<div class="form-group">
						<label class="col-sm-3 control-label">商品类目：</label>
						<div class="input-group col-sm-3">
							<select name="pid" class="form-control">
								<option value="0">请选择商品类目</option>
								{foreach name="$goodsType_list" item="vo"}
								<option value="{$vo.id}" {if condition="$pid==$vo.id" } selected="selected" {/if}>
									{neq name="vo.level" value="1"}|{php}for($i=1;$i<$vo[ 'level'];$i++){echo ' ----';}{/php}{/neq} {$vo.name}</option>
										{/foreach}
							</select>
						</div>
					</div>
					<!--<div class="form-group">
						<label class="col-sm-3 control-label">商品分类：</label>
						<div class="input-group col-sm-3">
							<input type="text" id="classify_1" name="classify_1" value="{$ad.classify_1}"  class="form-control" />
						</div>
					</div>-->
					<div class="form-group">
						<label class="col-sm-3 control-label">类型：</label>
						<div class="input-group col-sm-3">
						<input type="radio" name="goods_type" {if $ad.goods_type==0} {php echo checked="true"} {/if} value="0" /> 实物商品(物流发货)
						&nbsp;
						<input type="radio" name="goods_type" {if $ad.goods_type==1} {php echo checked="true"} {/if} value="1" /> 到店自提(无需物流)
						</div>
					</div>
				 </div>
				 </div>
				 <!--基本信息end-->
				 
				 <!--规格库存-->
				<div class="panel panel-default">
				<div class="panel-heading"> 规格库存</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="col-sm-3 control-label">商品规格：</label>
							<div class="input-group col-sm-3">
								<select name="goods_spec" class="form-control">
									<option value="0">请选择商品规格</option>
									{volist name="spec_list" id="vo"}
									<option value="{$vo.id}" >{$vo.name}</option>
									{/volist}
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">库存：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="repertory" name="repertory" value="{$ad.repertory}" class="form-control" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">总销量：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="sales" name="sales" value="{$ad.sales}" class="form-control" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">商品编码：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="number" name="number" value="{$ad.number}" class="form-control" />
							</div>
						</div>
				</div>
				</div>
				<!--规格库存end-->
				
				<!--商品信息-->
				<div class="panel panel-default">
				<div class="panel-heading"> 商品信息</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="col-sm-3 control-label">商品名称：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="name" name="name" value="{$ad.name}" class="form-control" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">门店价：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="original_price" name="original_price" value="{$ad.original_price}" class="form-control" />
								<label class="col-sm-3 control-label" style="position: absolute;text-align: left;">元</label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">销售价：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="current_price" name="current_price" value="{$ad.current_price}" class="form-control" />
								<label class="col-sm-3 control-label" style="position: absolute;text-align: left;">元</label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">重量：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="weight" name="weight" value="{$ad.weight}" class="form-control" />
								<label class="col-sm-3 control-label" style="position: absolute;text-align: left;">g/克</label>
							</div>
						</div>
						<div class="form-group">
						<label class="col-sm-3 control-label">商品封面图片：</label>
						<div class="input-group col-sm-4">
							<input type="hidden" id="thumb" name="thumb" value="{$ad.thumb}"/>
							<input id="upload" name="upload" type="file" />
						</div>
					</div>
				</div>
				</div>
				<!--商品信息end-->
				
				<!--商品栏目设置-->
				<div class="panel panel-default">
				<div class="panel-heading"> 商品栏目设置</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="col-sm-3 control-label">当前积分余额：</label>
							<div class="input-group col-sm-3">
								{$score}
								<!--<input type="text" id="" name="" value="" class="form-control" />-->
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">商品栏目：</label>
							<div class="input-group col-sm-3">
							<input type="radio" name="type" checked="true" value="0" /> 疯狂抢
							&nbsp;
							<input type="radio" name="type" value="1" /> 优惠购
							&nbsp;
							<input type="radio" name="type" value="2" /> 赚积分
							&nbsp;
							<input type="radio" name="type" value="3" /> 云拼团(单独发布)
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">该栏目商品名称：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="name" name="name" value="{$ad.name}" class="form-control" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">上架数量：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="" name="" value="" class="form-control" />
							</div>
						</div>
				</div>
				</div>
				<!--商品栏目设置end-->
				
				<!--商品栏目设置-->
				<div class="panel panel-default">
				<div class="panel-heading"> 其他</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="col-sm-3 control-label">销售状态：</label>
							<div class="input-group col-sm-3">
							<input type="radio" name="type1" value="0" checked="true"/> 上架
							&nbsp;
							<input type="radio" name="type1" value="1"/> 下架
							&nbsp;
							<input type="radio" name="type1" value="3" /> 回收站
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">发票：</label>
							<div class="input-group col-sm-3">
							<input type="radio" name="type2" value="0" checked="true"/> 无
							&nbsp;
							<input type="radio" name="type2" value="1"/> 有
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">保修：</label>
							<div class="input-group col-sm-3">
							<input type="radio" name="type3" value="0" checked="true"/> 无
							&nbsp;
							<input type="radio" name="type3" value="1"/> 有
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">排序：</label>
							<div class="input-group col-sm-3">
								<input type="text" id="sort" name="sort" value="{$ad.sort}" class="form-control" />
								<span>从大到小的顺序排列</span>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">运费模板：</label>
							<div class="input-group col-sm-3">
							<input type="radio" name="type4" value="0" checked="true"/> 包邮
							&nbsp;
							<input type="radio" name="type4" value="1"/> 选择运费模板
							</div>
						</div>
				</div>
				</div>
				<!--商品栏目设置end-->
				
					<!--商品详情-->
				<div class="panel panel-default">
				<div class="panel-heading">商品详情</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="col-sm-3 control-label">商品详情：</label>
							<div class="input-group col-sm-6">
								<textarea id="content" name="content"  style="height: 400px;">
								{$ad.content}
								</textarea>
							</div>
						</div>
					</div>
				</div>
				<!--商品详情end-->
				<div class="form-group">
						<div class="col-sm-4 col-sm-offset-3">
							<a href="{:url('index',['type'=>$type])}"" class="btn btn-danger"><i class="fa fa-arrow-left"></i> 返回 </a>
						</div>
				</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block} {block name="script"}
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__LIB__/ueditor/ueditor.config.js" type="text/javascript"></script>
<script src="__LIB__/ueditor/ueditor.all.js" type="text/javascript"></script>
<script>
	
	var ueditor = UE.getEditor('content');
	upload_one('{$ad.thumb}');
	$("#li-bar-distribution").addClass("active");
	$(function() {
		$("#myForm").validate({
			rules: {
				
			},
			messages: {
			
			},
			submitHandler: function(form) {
				ajaxForm();
			}
		});
	});
</script>
{/block}